package com.example.hotel_demo.service;


import com.example.hotel_demo.mapper.RoomCommodityMapper;
import com.example.hotel_demo.pojo.RoomCommodity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoomCommdityService {
    @Autowired
    private RoomCommodityMapper roomCommodityMapper;


    public List<RoomCommodity> getRoomCommAll() {
        return roomCommodityMapper.getRoomCommAll();
    }

    public List<RoomCommodity> getRoomCommByRoomID(int roomID) {
        return roomCommodityMapper.getRoomCommByRoomID(roomID);
    }

    public int updateRoomCommodityNameByRoomID(String commName, int roomID) {
        return roomCommodityMapper.updateRoomCommodityNameByRoomID(commName, roomID);
    }

    public int updateRoomCommodityByRoomID(String commName, int commPrice, int commNum, int roomID) {
        return roomCommodityMapper.updateRoomCommodityByRoomID(commName, commPrice, commNum, roomID);
    }

    public int addRoomCommodity(String commName, int commPrice, int commNum, int roomID) {
        return roomCommodityMapper.addRoomCommodity(commName, commPrice, commNum, roomID);
    }

    public int deleteCommodityByRoomIDAndCommName(int roomID,String commName){
        return roomCommodityMapper.deleteCommodityByRoomIDAndCommName(roomID,commName);
    }
}
